package com.kuaidi100.sdk.request;

import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.util.List;

/**
 * @Author: ligl
 * @Date: 2022-02-17 17:34
 */
public class CloudPrintParcelsBillReq<T> {
    /**
     * 通过管理后台的打印发货单模板配置信息获取
     */
    private String tempid;
    /**
     * 打印设备，通过打印机输出的设备码进行获取
     */
    private String siid;
    /**
     * 打印状态回调地址，默认仅支持http
     */
    private String callBackUrl;
    /**
     * 发货单表格列表内容，JsonArrayString类型，多表格时用tab0，tab1，tab2等追加对象
     */
    private List<T> tb0;
    /**
     * 多图片时用img0,img1,img2等追加
     */
    private ImageInfo img0;

    @Override
    public String toString() {
        try {
            ObjectMapper objectMapper = new ObjectMapper();
            return objectMapper.writeValueAsString(this);
        } catch (Exception e) {
            return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
                    .append("tempid", tempid)
                    .append("siid", siid)
                    .append("callBackUrl", callBackUrl)
                    .append("tb0", tb0)
                    .append("img0", img0)
                    .toString();
        }
    }

    public String getTempid() {
        return tempid;
    }

    public void setTempid(String tempid) {
        this.tempid = tempid;
    }

    public String getSiid() {
        return siid;
    }

    public void setSiid(String siid) {
        this.siid = siid;
    }

    public String getCallBackUrl() {
        return callBackUrl;
    }

    public void setCallBackUrl(String callBackUrl) {
        this.callBackUrl = callBackUrl;
    }

    public List<T> getTb0() {
        return tb0;
    }

    public void setTb0(List<T> tb0) {
        this.tb0 = tb0;
    }

    public ImageInfo getImg0() {
        return img0;
    }

    public void setImg0(ImageInfo img0) {
        this.img0 = img0;
    }
}
